/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.struts2.json.annotations.JSON;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "news_ads")
//@NamedQueries({@NamedQuery(name = "NewsAds.findAll", query = "SELECT n FROM NewsAds n"), @NamedQuery(name = "NewsAds.findByAdid", query = "SELECT n FROM NewsAds n WHERE n.adid = :adid"), @NamedQuery(name = "NewsAds.findByAdtext", query = "SELECT n FROM NewsAds n WHERE n.adtext = :adtext"), @NamedQuery(name = "NewsAds.findByAdpictureid", query = "SELECT n FROM NewsAds n WHERE n.adpictureid = :adpictureid"), @NamedQuery(name = "NewsAds.findByAdurl", query = "SELECT n FROM NewsAds n WHERE n.adurl = :adurl"), @NamedQuery(name = "NewsAds.findByAdstandtime", query = "SELECT n FROM NewsAds n WHERE n.adstandtime = :adstandtime"), @NamedQuery(name = "NewsAds.findByAdorder", query = "SELECT n FROM NewsAds n WHERE n.adorder = :adorder"), @NamedQuery(name = "NewsAds.findByAder", query = "SELECT n FROM NewsAds n WHERE n.ader = :ader"), @NamedQuery(name = "NewsAds.findByCreatetime", query = "SELECT n FROM NewsAds n WHERE n.createtime = :createtime"), @NamedQuery(name = "NewsAds.findByEndtime", query = "SELECT n FROM NewsAds n WHERE n.endtime = :endtime"), @NamedQuery(name = "NewsAds.findByBegintime", query = "SELECT n FROM NewsAds n WHERE n.begintime = :begintime"), @NamedQuery(name = "NewsAds.findByNote", query = "SELECT n FROM NewsAds n WHERE n.note = :note")})
public class NewsAds implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "adid")
    private Integer adid;
    @Column(name = "adtitle")
    private String adtitle;
	@Column(name = "adtext")
    private String adtext;
	@Column(name = "adfontsize")
    private Integer adfontsize;
	@Column(name = "adcolor")
    private String adcolor;
    @Column(name = "adpictureid")
    private Integer adpictureid;
    @Column(name = "adurl")
    private String adurl;
    @Column(name = "adstandtime")
    private Integer adstandtime;
    @Column(name = "adorder")
    private String adorder;
    @Column(name = "ader")
    private String ader;
    @Column(name = "createtime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createtime;
    @Column(name = "endtime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endtime;
    @Column(name = "begintime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date begintime;
    @Column(name = "note")
    private String note;
    @Column(name = "position")
    private Integer position;	//新增字段：广告位置（1页眉2页中）
    
    @Column(name = "adtype")
    private Integer adtype;
    
    @Column(name = "adstatus")
    private String adstatus;
    
    
    public String getAdtitle() {
		return adtitle;
	}

	public void setAdtitle(String adtitle) {
		this.adtitle = adtitle;
	}

    public Integer getAdtype() {
		return adtype;
	}

	public void setAdtype(Integer adtype) {
		this.adtype = adtype;
	}

	public String getAdstatus() {
		return adstatus;
	}

	public void setAdstatus(String adstatus) {
		this.adstatus = adstatus;
	}

	@JoinTable(name = "news_extends_firstchannel_ads", joinColumns = {@JoinColumn(name = "adid", referencedColumnName = "adid")}, inverseJoinColumns = {@JoinColumn(name = "channelid", referencedColumnName = "channelid")})
    @ManyToMany
    private Set<NewsExtendsFirstchannel> newsExtendsFirstchannelSet;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "newsAds")
    private Set<NewsExtendsChannelAds> newsExtendsChannelAdsSet;

    public NewsAds() {
    }

    public NewsAds(Integer adid) {
        this.adid = adid;
    }

    public Integer getAdid() {
        return adid;
    }

    public void setAdid(Integer adid) {
        this.adid = adid;
    }

    public String getAdtext() {
        return adtext;
    }

    public void setAdtext(String adtext) {
        this.adtext = adtext;
    }

    public Integer getAdfontsize() {
		return adfontsize;
	}

	public void setAdfontsize(Integer adfontsize) {
		this.adfontsize = adfontsize;
	}

	public String getAdcolor() {
		return adcolor;
	}

	public void setAdcolor(String adcolor) {
		this.adcolor = adcolor;
	}

	public Integer getAdpictureid() {
        return adpictureid;
    }

    public void setAdpictureid(Integer adpictureid) {
        this.adpictureid = adpictureid;
    }

    public String getAdurl() {
        return adurl;
    }

    public void setAdurl(String adurl) {
        this.adurl = adurl;
    }

    public Integer getAdstandtime() {
        return adstandtime;
    }

    public void setAdstandtime(Integer adstandtime) {
        this.adstandtime = adstandtime;
    }

    public String getAdorder() {
        return adorder;
    }

    public void setAdorder(String adorder) {
        this.adorder = adorder;
    }

    public String getAder() {
        return ader;
    }

    public void setAder(String ader) {
        this.ader = ader;
    }

	@JSON(format="yyyy-MM-dd HH:mm:ss")
    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

	@JSON(format="yyyy-MM-dd HH:mm:ss")
    public Date getEndtime() {
        return endtime;
    }

    public void setEndtime(Date endtime) {
        this.endtime = endtime;
    }

	@JSON(format="yyyy-MM-dd HH:mm:ss")
    public Date getBegintime() {
        return begintime;
    }

    public void setBegintime(Date begintime) {
        this.begintime = begintime;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Set<NewsExtendsFirstchannel> getNewsExtendsFirstchannelSet() {
        return newsExtendsFirstchannelSet;
    }

    public void setNewsExtendsFirstchannelSet(Set<NewsExtendsFirstchannel> newsExtendsFirstchannelSet) {
        this.newsExtendsFirstchannelSet = newsExtendsFirstchannelSet;
    }

    public Set<NewsExtendsChannelAds> getNewsExtendsChannelAdsSet() {
        return newsExtendsChannelAdsSet;
    }

    public void setNewsExtendsChannelAdsSet(Set<NewsExtendsChannelAds> newsExtendsChannelAdsSet) {
        this.newsExtendsChannelAdsSet = newsExtendsChannelAdsSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (adid != null ? adid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewsAds)) {
            return false;
        }
        NewsAds other = (NewsAds) object;
        if ((this.adid == null && other.adid != null) || (this.adid != null && !this.adid.equals(other.adid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.NewsAds[adid=" + adid + "]";
    }

	public Integer getPosition() {
		return position;
	}

	public void setPosition(Integer position) {
		this.position = position;
	}

}
